<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: left;">
<a href="<?php echo( base_url() ); ?>cmb/member/home/<?php echo( $urlKey ); ?>/" target="_self">Member Home</a>
->&nbsp<a href="<?php echo( base_url() ); ?>cmb/member_reports/gen_reports/<?php echo( $urlKey ); ?>/" target="_self">Reports Home</a>
->&nbsp<a href="<?php echo( base_url() ); ?>cmb/member_reports/gen_reports_mahasamadhi_home/<?php echo( $urlKey ); ?>/" target="_self">Mahasamadhi Reports Home</a>
</div>
<div class="walk-register-buttons" style="float: right;">
	<a href="<?php echo( base_url() ); ?>cmb/member/homepage_logout/"><img src="<?php echo( base_url() ); ?>assets/images/buttons/logout1.gif" border="0" /></a>
</div>

<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
			
	Spacer::Render(0, 40);

	echo('<div>');
	echo '<a href="'.base_url().'cmb/member_reports/download_mahasamadhi_registrants_badge_report/'.$urlKey.'/" target="_self">Download Badge Report</a>';
    echo('</div>');

	Spacer::Render(0, 20);
	
	$curdatetime = time();
	
	$curdate = date('l, F jS, Y', $curdatetime);
	Form::OpenFormItemSummary('Date:', 50);
		echo( form_label($curdate, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	$curtime = date('h:i:s A', $curdatetime);
	Form::OpenFormItemSummary('Time:', 50);
		echo( form_label($curtime, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	Form::OpenFormItemSummary('Year:', 260);
		echo( form_label($year, 'year', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	
	Form::OpenFormItemSummary('Number of search results:', 260);
		echo( form_label(count($mrhinfoarr), 'srchres', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');

	if (count($mrhinfoarr) > 0)
	{
		Spacer::Render(0, 20);
		$ir = 0;		
		foreach( $mrhinfoarr as $mrhobj)
		{
            $mrv = Mahasamadhi_registration_value::cast( $mrhobj );

            echo('<table border="1" bgcolor = "#D3D3D3" cellpadding="5" width="100%">');
            echo('<tr>');
            echo('<th><center>&nbsp<b>Reg&nbspCode</b>&nbsp</center></th>');
            echo('</tr>');        

			if ($ir % 2 != 0)
			{
				$rowColor = "#e0ffff";
			}
			else
			{
				$rowColor = "#ffffff";
			}

			echo('<tr bgcolor="'.$rowColor.'">');
			
            $numAdult = $mrv->getNumAdultRegistered() + $mrv->getNumCHYKRegistered();

			echo('<td><center>&nbsp'.$mrv->getRegCode().'&nbsp</center></td>'); 
			
			echo('</tr>');
						
			$ir++;
    
            echo('</table>');

            if (($mrv->getNumAdultRegistered() > 0) || ($mrv->getNumCHYKRegistered() > 0)  || ($mrv->getNumChildRegistered() > 0))
            {
                echo('<table border="1" bgcolor = "#D3D3D3" cellpadding="5" width="100%">');
                /*
                echo('<tr>');
                echo('<th><center>&nbsp<b>First&nbspName</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Last&nbspName</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Gender</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Age</b>&nbsp</center></th>');
                echo('</tr>'); */
            }
            
            $numAdult = $mrv->getNumAdultRegistered();
            if ($numAdult > 0)
            {
                $ir = 0;        
                for($i=0; $i<$numAdult; $i++)
                {
                    $adultInfoArr = $mrv->getAdultInfo();
                    $adultRec = $adultInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$adultRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$adultRec["lastname"].'&nbsp</center></td>');
                    echo('</tr>');
                    
                    $ir++;
                }                                
            }
            
            $numCHYK = $mrv->getNumCHYKRegistered();
            if ($numCHYK > 0)
            {
                $ir = 0;
                for($i=0; $i<$numCHYK; $i++)
                {
                    $chykInfoArr = $mrv->getCHYKInfo();
                    $chykRec = $chykInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$chykRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$chykRec["lastname"].'&nbsp</center></td>');
                    echo('</tr>');
                    
                    $ir++;
                }
            }

            $numChild = $mrv->getNumChildRegistered();
            if ($numChild > 0)
            {
                $ir = 0;        
                for($i=0; $i<$numChild; $i++)
                {
                    $childInfoArr = $mrv->getChildInfo();
                    $childRec = $childInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$childRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$childRec["lastname"].'&nbsp</center></td>');
                    echo('</tr>');

                    $ir++;
                }
                                
                echo('</table>');                
            }

            if (($mrv->getNumAdultRegistered() > 0) || ($mrv->getNumCHYKRegistered() > 0) || ($mrv->getNumChildRegistered() > 0))
                echo('</table>');                
            
            Spacer::Render(0, 50);
		}

	}
	else
		echo "No results returned";
?>
</div>
